			cpu					5307

PROGRAM 		equ 	$10200000
OPERAND 		equ 	$10210000
BUFFER 			equ 	$10220000
STACK 			equ 	$10230000
				
				org		OPERAND
MENU			dc.b	CR,LF,"~~~ MAIN MENU ~~~",CR,LF
				dc.b	"0. Return to Monitor",CR,LF
				dc.b	"1. Clock Display",CR,LF
				dc.b	"2. Enter Clock Mode",CR,LF
				dc.b	"3. Enter Calculator Mode",CR,LF,CR,LF
				dc.b	"Please Enter Choice:",0

		; ******** START OF PROGRAM ***********
				
				org		PROGRAM
				
		; Show Menu to user
		
start			lea		MENU,A1			;point to start of message
				bsr.w	out_string		;print message
				bsr.w	out_crlf		;go to next line
				
		; Get user selection

				lea		BUFFER,A1		;point to start of buffer
				bsr.w	in_string		;read string and adda a trailing null
				bsr.w	out_crlf		;go to next line
				
		; Convert to DEC
				
				lea		BUFFER,A1		;point to start of buffer
				; TODO - should do error checking here and ensure it's a valid choice
				bsr.w	dec2bin
				move.l	D0,D1
				bsr.w	bin2dec
				movea.l	A2,A1
				bsr.w	out_string
				
		; ...TODO
				
		; Exit
				move.l	#$0000,D0
				TRAP	#15
				
				include	io.asm
				
				end					; marking end of assembly